package esmaltes.bean;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

public class TemplateBean {

	public static void showFacesMessage(String texto, int tipo) {
        switch (tipo) {
            case 1:
                FacesContext.getCurrentInstance()
                        .addMessage(
                                null,
                                new FacesMessage(FacesMessage.SEVERITY_ERROR,
                                        texto, "Erro"));
                break;
            case 2:
                FacesContext.getCurrentInstance().addMessage(
                        null,
                        new FacesMessage(FacesMessage.SEVERITY_INFO, texto,
                                "Informação"));
                break;
            case 3:
                FacesContext.getCurrentInstance()
                        .addMessage(
                                null,
                                new FacesMessage(FacesMessage.SEVERITY_WARN, texto,
                                        "Aviso"));
                break;
            case 4:
                FacesContext.getCurrentInstance().addMessage(
                        null,
                        new FacesMessage(FacesMessage.SEVERITY_FATAL, texto,
                                "Fatal"));
                break;
        }
    }
	
}
